package com.example.experiment05.mapper;

import com.example.experiment05.dto.UserAddress01;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @description:
 * @author: YancyZhang
 * @time: 2022/6/20 15:39
 */
public class UserAddress01RowMapper implements RowMapper<UserAddress01> {
    @Override
    public UserAddress01 mapRow(ResultSet rs, int rowNum) throws SQLException {
        DateTimeFormatter formatter = DateTimeFormatterUtils.getFormatter();
        return UserAddress01.builder()
                .userId(rs.getLong("user_id"))
                .detail(rs.getString("detail"))
                .name(rs.getString("name"))
                .Id(rs.getLong("id"))
                .createTime(rs.getDate("a.create_time"))
                .build();
    }
}